<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>  
        // splice(start)  由start索引开始删除数组元素，删除元素个数为arr.length - start
        var arr1 = ['one','two','three','four','five','six'];
        console.log(arr1.splice(1));     //返回由被删除的元素组成的一个数组
        console.log(arr1);               //返回被删除元素后的数组


        // splice(start, deleteCount)   由start索引开始删除数组元素，删除元素个数为deleteCount
        var arr2 = ['one','two','three','four','five','six'];
        console.log(arr2.splice(2,3));
        console.log(arr2);
        
        // splice(start, deleteCount, item1) 由start索引开始删除数组元素，删除元素个数为deleteCount,然后在start位置添加元素item1
        var arr3 = ['one','two','three','four','five','six'];
        console.log(arr3.splice(2,3,'zero'));
        console.log(arr3);

        // splice(start, deleteCount, item1, item2, itemN) 由start索引开始删除数组元素，删除元素个数为deleteCount,然后在start位置开始添加元素item1，item2....
        var arr4 = ['one','two','three','four','five','six'];
        console.log(arr4.splice(2,3,'zero','ten'));
        console.log(arr4)
    </script>
</head>
<body>
    
</body>
</html>